3.21.62 \(\int \frac {a+b x}{(1+x) (1-x+x^2)} \, dx\)

Optimal. Leaf size=54 \[ -\frac {1}{6} (a-b) \log \left (x^2-x+1\right )+\frac {1}{3} (a-b) \log (x+1)-\frac {(a+b) \tan ^{-1}\left (\frac {1-2 x}{\sqrt {3}}\right )}{\sqrt {3}} \]

________________________________________________________________________________________

Rubi [A]  time = 0.07, antiderivative size = 54, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {800, 634, 618, 204, 628} \begin {gather*} -\frac {1}{6} (a-b) \log \left (x^2-x+1\right )+\frac {1}{3} (a-b) \log (x+1)-\frac {(a+b) \tan ^{-1}\left (\frac {1-2 x}{\sqrt {3}}\right )}{\sqrt {3}} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + b*x)/((1 + x)*(1 - x + x^2)),x]

[Out]

-(((a + b)*ArcTan[(1 - 2*x)/Sqrt[3]])/Sqrt[3]) + ((a - b)*Log[1 + x])/3 - ((a - b)*Log[1 - x + x^2])/6

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 628

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(d*Log[RemoveContent[a + b*x +
c*x^2, x]])/b, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 634

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 800

Int[(((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_)))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Int[Exp
andIntegrand[((d + e*x)^m*(f + g*x))/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e, f, g}, x] && NeQ[b^2 -
 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && IntegerQ[m]

Rubi steps

\begin {align*} \int \frac {a+b x}{(1+x) \left (1-x+x^2\right )} \, dx &=\int \left (\frac {a-b}{3 (1+x)}+\frac {2 a+b-(a-b) x}{3 \left (1-x+x^2\right )}\right ) \, dx\\ &=\frac {1}{3} (a-b) \log (1+x)+\frac {1}{3} \int \frac {2 a+b-(a-b) x}{1-x+x^2} \, dx\\ &=\frac {1}{3} (a-b) \log (1+x)+\frac {1}{6} (-a+b) \int \frac {-1+2 x}{1-x+x^2} \, dx+\frac {1}{2} (a+b) \int \frac {1}{1-x+x^2} \, dx\\ &=\frac {1}{3} (a-b) \log (1+x)-\frac {1}{6} (a-b) \log \left (1-x+x^2\right )+(-a-b) \operatorname {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,-1+2 x\right )\\ &=-\frac {(a+b) \tan ^{-1}\left (\frac {1-2 x}{\sqrt {3}}\right )}{\sqrt {3}}+\frac {1}{3} (a-b) \log (1+x)-\frac {1}{6} (a-b) \log \left (1-x+x^2\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.03, size = 49, normalized size = 0.91 \begin {gather*} \frac {1}{6} (a-b) \left (2 \log (x+1)-\log \left (x^2-x+1\right )\right )+\frac {(a+b) \tan ^{-1}\left (\frac {2 x-1}{\sqrt {3}}\right )}{\sqrt {3}} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + b*x)/((1 + x)*(1 - x + x^2)),x]

[Out]

((a + b)*ArcTan[(-1 + 2*x)/Sqrt[3]])/Sqrt[3] + ((a - b)*(2*Log[1 + x] - Log[1 - x + x^2]))/6

________________________________________________________________________________________

IntegrateAlgebraic [F]  time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {a+b x}{(1+x) \left (1-x+x^2\right )} \, dx \end {gather*}

Verification is not applicable to the result.

[In]

IntegrateAlgebraic[(a + b*x)/((1 + x)*(1 - x + x^2)),x]

[Out]

IntegrateAlgebraic[(a + b*x)/((1 + x)*(1 - x + x^2)), x]

________________________________________________________________________________________

fricas [A]  time = 0.40, size = 47, normalized size = 0.87 \begin {gather*} \frac {1}{3} \, \sqrt {3} {\left (a + b\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) - \frac {1}{6} \, {\left (a - b\right )} \log \left (x^{2} - x + 1\right ) + \frac {1}{3} \, {\left (a - b\right )} \log \left (x + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((b*x+a)/(1+x)/(x^2-x+1),x, algorithm="fricas")

[Out]

1/3*sqrt(3)*(a + b)*arctan(1/3*sqrt(3)*(2*x - 1)) - 1/6*(a - b)*log(x^2 - x + 1) + 1/3*(a - b)*log(x + 1)

________________________________________________________________________________________

giac [A]  time = 0.15, size = 53, normalized size = 0.98 \begin {gather*} \frac {1}{3} \, {\left (\sqrt {3} a + \sqrt {3} b\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) - \frac {1}{6} \, {\left (a - b\right )} \log \left (x^{2} - x + 1\right ) + \frac {1}{3} \, {\left (a - b\right )} \log \left ({\left | x + 1 \right |}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((b*x+a)/(1+x)/(x^2-x+1),x, algorithm="giac")

[Out]

1/3*(sqrt(3)*a + sqrt(3)*b)*arctan(1/3*sqrt(3)*(2*x - 1)) - 1/6*(a - b)*log(x^2 - x + 1) + 1/3*(a - b)*log(abs
(x + 1))

________________________________________________________________________________________

maple [A]  time = 0.06, size = 74, normalized size = 1.37 \begin {gather*} \frac {\sqrt {3}\, a \arctan \left (\frac {\left (2 x -1\right ) \sqrt {3}}{3}\right )}{3}+\frac {a \ln \left (x +1\right )}{3}-\frac {a \ln \left (x^{2}-x +1\right )}{6}+\frac {\sqrt {3}\, b \arctan \left (\frac {\left (2 x -1\right ) \sqrt {3}}{3}\right )}{3}-\frac {b \ln \left (x +1\right )}{3}+\frac {b \ln \left (x^{2}-x +1\right )}{6} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((b*x+a)/(x+1)/(x^2-x+1),x)

[Out]

1/3*ln(x+1)*a-1/3*ln(x+1)*b-1/6*ln(x^2-x+1)*a+1/6*ln(x^2-x+1)*b+1/3*3^(1/2)*arctan(1/3*(2*x-1)*3^(1/2))*a+1/3*
3^(1/2)*arctan(1/3*(2*x-1)*3^(1/2))*b

________________________________________________________________________________________

maxima [A]  time = 1.32, size = 47, normalized size = 0.87 \begin {gather*} \frac {1}{3} \, \sqrt {3} {\left (a + b\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) - \frac {1}{6} \, {\left (a - b\right )} \log \left (x^{2} - x + 1\right ) + \frac {1}{3} \, {\left (a - b\right )} \log \left (x + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((b*x+a)/(1+x)/(x^2-x+1),x, algorithm="maxima")

[Out]

1/3*sqrt(3)*(a + b)*arctan(1/3*sqrt(3)*(2*x - 1)) - 1/6*(a - b)*log(x^2 - x + 1) + 1/3*(a - b)*log(x + 1)

________________________________________________________________________________________

mupad [B]  time = 2.34, size = 78, normalized size = 1.44 \begin {gather*} \ln \left (x+1\right )\,\left (\frac {a}{3}-\frac {b}{3}\right )+\ln \left (x-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {b}{6}-\frac {a}{6}+\frac {\sqrt {3}\,a\,1{}\mathrm {i}}{6}+\frac {\sqrt {3}\,b\,1{}\mathrm {i}}{6}\right )-\ln \left (x-\frac {1}{2}-\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {a}{6}-\frac {b}{6}+\frac {\sqrt {3}\,a\,1{}\mathrm {i}}{6}+\frac {\sqrt {3}\,b\,1{}\mathrm {i}}{6}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*x)/((x + 1)*(x^2 - x + 1)),x)

[Out]

log(x + (3^(1/2)*1i)/2 - 1/2)*(b/6 - a/6 + (3^(1/2)*a*1i)/6 + (3^(1/2)*b*1i)/6) - log(x - (3^(1/2)*1i)/2 - 1/2
)*(a/6 - b/6 + (3^(1/2)*a*1i)/6 + (3^(1/2)*b*1i)/6) + log(x + 1)*(a/3 - b/3)

________________________________________________________________________________________

sympy [C]  time = 0.43, size = 201, normalized size = 3.72 \begin {gather*} \frac {\left (a - b\right ) \log {\left (x + \frac {a^{2} \left (a - b\right ) + 2 a b^{2} + b \left (a - b\right )^{2}}{a^{3} + b^{3}} \right )}}{3} + \left (- \frac {a}{6} + \frac {b}{6} - \frac {\sqrt {3} i \left (a + b\right )}{6}\right ) \log {\left (x + \frac {3 a^{2} \left (- \frac {a}{6} + \frac {b}{6} - \frac {\sqrt {3} i \left (a + b\right )}{6}\right ) + 2 a b^{2} + 9 b \left (- \frac {a}{6} + \frac {b}{6} - \frac {\sqrt {3} i \left (a + b\right )}{6}\right )^{2}}{a^{3} + b^{3}} \right )} + \left (- \frac {a}{6} + \frac {b}{6} + \frac {\sqrt {3} i \left (a + b\right )}{6}\right ) \log {\left (x + \frac {3 a^{2} \left (- \frac {a}{6} + \frac {b}{6} + \frac {\sqrt {3} i \left (a + b\right )}{6}\right ) + 2 a b^{2} + 9 b \left (- \frac {a}{6} + \frac {b}{6} + \frac {\sqrt {3} i \left (a + b\right )}{6}\right )^{2}}{a^{3} + b^{3}} \right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((b*x+a)/(1+x)/(x**2-x+1),x)

[Out]

(a - b)*log(x + (a**2*(a - b) + 2*a*b**2 + b*(a - b)**2)/(a**3 + b**3))/3 + (-a/6 + b/6 - sqrt(3)*I*(a + b)/6)
*log(x + (3*a**2*(-a/6 + b/6 - sqrt(3)*I*(a + b)/6) + 2*a*b**2 + 9*b*(-a/6 + b/6 - sqrt(3)*I*(a + b)/6)**2)/(a
**3 + b**3)) + (-a/6 + b/6 + sqrt(3)*I*(a + b)/6)*log(x + (3*a**2*(-a/6 + b/6 + sqrt(3)*I*(a + b)/6) + 2*a*b**
2 + 9*b*(-a/6 + b/6 + sqrt(3)*I*(a + b)/6)**2)/(a**3 + b**3))

________________________________________________________________________________________